package com.aitesting.testcase;

import com.aitesting.constant.MethodEnum;
import com.aitesting.domain.TRequest;
import com.aitesting.domain.TStep;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * 完成创建测试步骤对象，及请求对象
 */
@Data
public class RunRequest {
    private String name;
    public TStep step;

    public RunRequest(String name) {
        this.step = new TStep(name);
    }

    public StepWithOptionArgs get(String url){
        this.step.setRequest(new TRequest(MethodEnum.GET, url));
        return new StepWithOptionArgs(step);
    }

    public StepWithOptionArgs post(String url){
        this.step.setRequest(new TRequest(MethodEnum.POST, url));
        return new StepWithOptionArgs(step);
    }

    public StepWithOptionArgs delete(String url){
        this.step.setRequest(new TRequest(MethodEnum.DELETE, url));
        return new StepWithOptionArgs(step);
    }

    public StepWithOptionArgs put(String url){
        this.step.setRequest(new TRequest(MethodEnum.PUT, url));
        return new StepWithOptionArgs(step);
    }

    public StepWithOptionArgs patch(String url){
        this.step.setRequest(new TRequest(MethodEnum.PATCH, url));
        return new StepWithOptionArgs(step);
    }

    public StepWithOptionArgs head(String url){
        this.step.setRequest(new TRequest(MethodEnum.HEAD, url));
        return new StepWithOptionArgs(step);
    }

    public StepWithOptionArgs options(String url){
        this.step.setRequest(new TRequest(MethodEnum.OPTIONS, url));
        return new StepWithOptionArgs(step);
    }
}
